package com.seuic.hnjiningposapp.hnapps.util;

import android.util.Log;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 *
 */
public class ShowDownFtpInfoUtils {


    public static String getData() {
        String data = "";
        File file = new File(Api.FTPDOWNADRESSINFO);
        String str = null;
        try {
            String Alldata = "";
            InputStream is = new FileInputStream(file);
            InputStreamReader input = new InputStreamReader(is, "UTF-8");
            BufferedReader reader = new BufferedReader(input);
            while ((str = reader.readLine()) != null) {
//                Log.e("strdada", str);
                Alldata = Alldata + "," + str;
//                if (reader.readLine())
            }
            String[] All = Alldata.split(",");
//            Log.e("Alldada", All.length + "");
            List<String> newAllCash_OCRdata = new ArrayList<>();
            for (int i = 8; i < All.length; i++) {
                newAllCash_OCRdata.add(All[i]);
            }
//            Log.e("newAllCash_OCRdata", newAllCash_OCRdata.size() + "");
            for (int i = 0; i < newAllCash_OCRdata.size(); i++) {
                if (newAllCash_OCRdata.get(i).split("=")[1].contains("_")) {
                    data = "";
                    break;
                } else {
                    data = data + "," + newAllCash_OCRdata.get(i).split("=")[1];
                }
            }
            if (data!=""){
                data = data.substring(1);
            }
        } catch (
                IOException e) {
            e.printStackTrace();
        }
//        Log.e("aaaaaaa", data + "");
        return data;
    }




}
